package cn.just.service;

import cn.just.dao.UserDao;
import cn.just.entity.User;

import java.sql.SQLException;

/**
 * @author wujiaming
 */
public class UserService {

    UserDao userDao = new UserDao();

    /**
     * 注册
     * @param user
     */
    public void save(User user){
        try {
            userDao.save(user);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }

    /**
     * 登录
     * @param user
     * @return
     */
    public User findUserById(String name, String pwd){
        try {
            return userDao.findUserById(name,pwd);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return null;
    }

}
